<!--<div style="text-align:right;">
          <input name="" type="button" class="btn_1" value="返回" />
          <input name="" type="button" class="btn_1" value="前一个订单" />
          <input name="" type="button" class="btn_1" value="后一个订单" />
          <input name="" type="button" class="btn_1" value="打印订单" />
</div>-->
<script>
function checkNum(obj)
{
 var re = /^-?[1-9]*(\.\d*)?$|^-?d^(\.\d*)?$/;
     if (!re.test(obj.value))
    {
			if(isNaN(obj.value)){  alert("非法数字");
		obj.value="";
        obj.focus();
        return false;}

     }
}  

$(function(){
	$('#queren_hetong').submit(function(){
		
		if($('#contract_number').val()=='')
    	{
    		$('#contract_number').focus();
        	alert('合同号不能为空!');
        	return false;
    	}
    	if($('#price_content_time1').val()=='')
    	{
    		$('#price_content_time1').focus();
        	alert('预付款时间不能为空!');
        	return false;
    	}
    	if($('#price_content_price1').val()=='')
    	{
    		$('#price_content_price1').focus();
        	alert('预付款金额不能为空!');
        	return false;
    	}
    	if($('#price_content_percent1').val()=='')
    	{
    		$('#price_content_percent1').focus();
        	alert('预付百分比不能为空!');
        	return false;
    	}

    	
    	if($('#price_content_time2').val()=='')
    	{
    		$('#price_content_time2').focus();
        	alert('收获后付款时间不能为空!');
        	return false;
    	}
    	if($('#price_content_price2').val()=='')
    	{
    		$('#price_content_price2').focus();
        	alert('收获后付款金额不能为空!');
        	return false;
    	}
    	if($('#price_content_percent2').val()=='')
    	{
    		$('#price_content_percent2').focus();
        	alert('收获后付款百分比不能为空!');
        	return false;
    	}


    	if($('#price_content_time3').val()=='')
    	{
    		$('#price_content_time3').focus();
        	alert('尾款付款时间不能为空!');
        	return false;
    	}
    	if($('#price_content_price3').val()=='')
    	{
    		$('#price_content_price3').focus();
        	alert('尾款付款金额不能为空!');
        	return false;
    	}
    	if($('#price_content_percent3').val()=='')
    	{
    		$('#price_content_percent3').focus();
        	alert('尾款付款百分比不能为空!');
        	return false;
    	}

		
		
		$.post(location.href,$(this).serialize(),function(data){
			alert(data.message);
			if (data.state == 1)
			{
				window.location.reload();
			}
		},'json');
		return false;
	});
	$('#queren_price').submit(function(){
		$.post(location.href,$(this).serialize(),function(data){
			alert(data.message);
			if (data.state == 1)
			{
				window.location.reload();
			}
		},'json');
		return false;
	});
});
</script>
<div class="line_1"></div>

<div class="t_2">
     <div class="fl">收货人（用户）信息</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td width="10%" class="td1">收货人：</td>
                <td width="15%"><?=$this->order['username']?></td>
                <td width="10%" class="td1">联系电话：</td>
                <td width="15%"><?=$this->order['tel']?></td>
                <td width="10%" class="td1">地址：</td>
                <td width="15%"><?=$this->order['address']?></td>
                <td width="10%" class="td1">邮编：</td>
                <td width="15%"><?=$this->order['zip']?></td>
            </tr>
     </table>
</div>
<div class="line_1"></div>
<!-- 商品信息 -->


<div class="t_2">
     <div class="fl">订单商品详情[待确认]</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
	 <form id="queren_price">
     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            <tr>
                <th>商品名称[品牌]</th>
                <th width="100">货号</th>
                <th width="70">库存</th>
                <th width="70">购买数量</th>
                <th width="70">约定单价</th>
            </tr>
			<?php foreach((array)$this->order_product_list as $product): ?>
            <tr>
                <td class="td2"><?=$product['product_name']?></td>
                <td><?=$product['code']?></td>
                <td><?=$product['num']?></td>
                <td><?=$product['product_num']?></td>
                <td><input name="pprice[<?=$product['product_id']?>]" value="<?=$product['product_pprice']?>" type="text" class="input_1" /></td>
            </tr>
			<?php endforeach; ?>
            <tr>
                <td colspan="6" class="td1"><input name="" type="submit" class="btn_1" value="确认" /><?=showhide(array('type'=>'queren','opt'=>'price'))?></td>
            </tr>
     </table>
	 </form>
</div>

<div class="line_1"></div>


<div class="t_2">
     <div class="fl">合同信息[待确认]</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
	 <form id="queren_hetong">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td width="10%" class="td1">合同号：</td>
                <td width="40%"><input name="contract_number" id="contract_number" value="<?=$this->order['contract_number']?>"/></td>
                <td width="10%" class="td1">合同类型：</td>
                <td width="40%">
					<?=$this->contract;?>
				</td>
            </tr>
     </table>
     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
            <tr>
                <td rowspan="3" class="td1" width="10%">付款信息：</td>
                <td class="td1" width="15%">预付款时间：</td>
                <td width="15%"><input type="text" name="price_content[1][time]" id="price_content_time1" value="<?=$this->cpc[1]['time']?>" onclick="new Calendar().show(this)" readonly="1"/></td>
                <td class="td1" width="15%">预付款金额：</td>
                <td width="15%"><input type="text" name="price_content[1][price]" onkeyup="checkNum(this)"  value="<?=$this->cpc[1]['price']?>" id="price_content_price1" value=""/></td>
                <td class="td1" width="15%">预付百分比：</td>
                <td width="15%"><input type="text" name="price_content[1][percent]" onkeyup="checkNum(this)" value="<?=$this->cpc[1]['percent']?>" id="price_content_percent1" value=""/></td>
            </tr>
            <tr>
                <td class="td1">收货后付款时间：</td>
                <td><input type="text" name="price_content[2][time]" value="<?=$this->cpc[2]['time']?>" id="price_content_time2"  onclick="new Calendar().show(this)" readonly="1"/></td>
                <td class="td1">收货后付款金额：</td>
                <td><input type="text" name="price_content[2][price]"  value="<?=$this->cpc[2]['price']?>"  onkeyup="checkNum(this)" id="price_content_price2" /></td>
                <td class="td1">收货后付款百分比：</td>
                <td><input type="text" name="price_content[2][percent]"  value="<?=$this->cpc[2]['percent']?>" onkeyup="checkNum(this)" id="price_content_percent2"/></td>
            </tr>
            <tr>
                <td class="td1">尾款付款时间：</td>
                <td><input type="text" name="price_content[3][time]" value="<?=$this->cpc[3]['time']?>" id="price_content_time3"   onclick="new Calendar().show(this)" readonly="1"/></td>
                <td class="td1">尾款付款金额：</td>
                <td><input type="text" name="price_content[3][price]" value="<?=$this->cpc[3]['price']?>" onkeyup="checkNum(this)"  id="price_content_price3"  /></td>
                <td class="td1">尾款付款百分比：</td>
                <td><input type="text" name="price_content[3][percent]" value="<?=$this->cpc[3]['percent']?>"   onkeyup="checkNum(this)" id="price_content_percent3" /></td>
            </tr>
			<tr>
				<td class="td1">付款银行信息</td>
				<td class="td1">付款银行</td>
				<td>
					<?=$this->banks;?>
				</td>
				<td class="td1">付款银行帐号</td>
				<td><input name="bank_no" value="<?=$this->order['bank_no']?>" /></td>
			</tr>
            <tr>
                <th colspan="7"><input name="" type="submit" class="btn_1" value="确认" /><?=showhide(array('type'=>'queren','opt'=>'hetong'))?></th>
            </tr>
     </table>
	 </form>
</div>

<div class="line_1"></div>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
     <tr>
          <td width="50%" valign="top" style="padding-right:5px;">
<div class="t_2">
     <div class="fl">订单付款信息</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <th width="20%">执行人</th>
                <th width="20%">付款金额</th>
                <th width="20%">剩余金额</th>
                <th>操作备注</th>
                <th width="20%">操作时间</th>
            </tr>
			<?php foreach((array)$this->order_payed_history as $item): ?>
			<tr>
				<td><?=$item['username']?></td>
				<td><?=$item['payed']?></td>
				<td><?=$item['arr']?></td>
				<td><?=$item['mark']?></td>
				<td><?= date('Y-m-d H:i:s',$item['created_time'])?></td>
			</tr>
			<?php endforeach; ?>
     </table>
</div>
<div class="line_1"></div>
          </td>
          <td width="50%" valign="top" style="padding-left:5px;">
<div class="t_2">
     <div class="fl">发票信息</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="td1" width="20%">发票名称：</td>
                <td width="30%"><?=$this->order['fp_name']?></td>
                <td class="td1" width="20%">发票内容：</td>
                <td width="30%"><?=$this->order['fp_nr']?></td>
            </tr>
     </table>
</div>
<div class="line_1"></div>
          </td>
     </tr>
     <tr>
          <td valign="top" style="padding-right:5px;">
<div class="t_2">
     <div class="fl">基本信息</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td width="20%" class="td1">订单号：</td>
                <td width="30%"><?=$this->order['order_sn']?></td>
                <td width="20%" class="td1">订单状态：</td>
                <td width="30%"><?=orderState($this->order['audit_state'])?></td>
            </tr>
            <tr>
                <td class="td1">购货人：</td>
                <td><?=$this->order['customer_name']?></td>
                <td class="td1">下单时间：</td>
                <td><?= date('Y-m-d H:i:s',$this->order['created_time'])?></td>
            </tr>
            <tr>
                <td class="td1">配送方式：</td>
                <td>快递</td>
                <td class="td1">发货时间：</td>
                <td>未发货</td>
            </tr>
            <tr>
                <td class="td1">发货单号：</td>
                <td>-</td>
                <td class="td1">订单来源：</td>
                <td>客户前台下单</td>
            </tr>
     </table>
</div>
<div class="line_1"></div>
          </td>
          <td valign="top" style="padding-left:5px;">
<div class="t_2">
     <div class="fl">操作信息</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<?php if(!$this->operation): ?>
		<tr><td>不能执行任何操作</td></tr>
		<?php else: ?>
		<tr>
			<td class="td1" width="110">操作备注：</td>
			<td><textarea name="mark" id="mark"></textarea></td>
	    </tr>
		<tr>
			<td class="td1" width="110">下级操作员列表：</td>
			<td><?=$this->users_html?></td>
	    </tr>
		<tr>
			<td class="td1">操作</td>
			<td><?=$this->operation?><input rel='opt' value="作废" title="trash" class="button" type="button" style="color:red;font-weight:bold;" /></td>
		</tr>
		<?php endif; ?>
     </table>
</div>
<div class="line_1"></div>
          </td>
     </tr>
</table>

<div class="t_2">
     <div class="fl">订单操作历史记录</div>
     <div class="fr order_title">--</div>
</div>
<div class="order_show">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <th width="15%">执行人</th>
                <th width="15%">执行时间</th>
                <th width="35%">内容</th>
                <th width="35%">备注</th>
            </tr>
			<?php foreach((array)$this->order_history as $history): ?>
            <tr>
                <td><?=$history['username']?></td>
                <td><?= date('Y-m-d H:i:s',$history['timestamp'])?></td>
                <td><?=$history['desc']?></td>
                <td><?=$history['mark']?></td>
            </tr>
			<?php endforeach; ?>
     </table>
</div>
<div class="line_1"></div>


<script>
$(function(){
	<?php if($this->step == 'caiwu'): ?>
    $('input[title=jiakuan]').click(function(){
        $.post(location.href,{type:'jiakuan',mark:$('#mark').val(),price:$('#price').val(),confirm_price:$('#confirm_price').val()},function(data){
            alert(data.message);
            if (data.state <= 0)
            {
                return false;
            }
            else
            {
                window.location.reload();
            }
        },'json');
    });
	<?php else: ?>
    $('input[rel=opt]').click(function(){
        var curinput = $(this);
        var opt = curinput.attr('title');
        if ('trash' == opt && !confirm('确定作废该订单？')) return false;
        var next_uid = $('#next_uid').val();
        var mark = $('#mark').val();
        curinput.attr('disabled','disabled');
        $.post(location.href,{type:opt,next_uid:next_uid,mark:mark},function(data){
            alert(data.message);
            curinput.removeAttr('disabled');
            if (data.state <= 0)return false;
            window.location.reload();
        },'json');
    });
	<?php endif; ?>
});
</script>